package com.lvcoding.thridlogin;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.security.Principal;

/**
 * @author wuyanshen
 * @description 描述
 */
@EnableOAuth2Sso
@SpringBootApplication
public class ThirdLoginApp {
    public static void main(String[] args) {
        SpringApplication.run(ThirdLoginApp.class, args);
    }

    // @ConfigurationProperties("security.oauth2.client")
    // @Bean
    // public ClientCredentialsResourceDetails details() {
    //     return new ClientCredentialsResourceDetails();
    // }
    //
    // @Bean
    // public RestTemplate restTemplate() {
    //     return new OAuth2RestTemplate(details());
    // }
    //
    // @Override
    // public void run(String... args) throws Exception {
    //     String url = "http://localhost:6000/test/needAuth";
    //     String result = restTemplate().getForObject(url, String.class);
    //     System.out.println("result = " + result);
    // }

}
